/**
 * @author 雷明浩
 * @date 2025/7/18 16:07
 */
public class BigNumAdd {
    // 大数加法
    // https://www.nowcoder.com/practice/11ae12e8c6fe48f883cad618c2e81475?tpId=295&tags=&title=&difficulty=0&judgeStatus=0&rp=0&sourceUrl=%2Fexam%2Foj%3Fpage%3D1%26tab%3D%25E7%25AE%2597%25E6%25B3%2595%25E7%25AF%2587%26topicId%3D295
    public String solve (String s, String t) {
        // write code here
        int tmp = 0;
        char[] c1 = s.toCharArray();
        char[] c2 = t.toCharArray();
        int index1 = c1.length-1;
        int index2 = c2.length-1;
        StringBuilder ret = new StringBuilder();
        while (index1 >= 0 || index2 >= 0 ||tmp != 0) {
            int num1 = index1 >= 0 ? c1[index1]-'0' : 0;
            int num2 = index2 >= 0 ? c2[index2]-'0' : 0;
            int sum = num1 + num2 + tmp;
            ret.append(sum % 10);
            tmp = sum / 10;
            index1--;
            index2--;
        }
        return ret.reverse().toString();
    }
}